package negocio;

import java.util.ArrayList;
import javax.persistence.Entity;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import beans.BarraVO;
import beans.PlatoVO;

@Entity
@PrimaryKeyJoinColumn(name="id_barra")
@Table(name="barra")
public class Barra extends Area
{

	private static final long serialVersionUID = 1L;
	
	public Barra(){}
	
	public Barra(Deposito depositoLocal){
		super("Barra", depositoLocal);
	}
	
	public BarraVO getVO()
	{
		BarraVO barraVO = new BarraVO();
		barraVO.setDeposito(getDepositoArea().getVO());
		
		ArrayList<PlatoVO> platosVOs = new ArrayList<PlatoVO>();
		for(Plato p : this.getPlatosPendientes())
		{
			PlatoVO platoVO=p.getVO();
			platosVOs.add(platoVO);
		}
		barraVO.setPlatosPendientes(platosVOs);
		
		return barraVO;
	}
	
	@Override
	public String toString() {
		return "Barra []";
	}
}
